#include <stdio.h>
#include <math.h>

double funcos( double e, double x );

int main()
{    
    double e, x;

    scanf("%lf %lf", &e, &x);
    printf("cos(%.2f) = %.6f\n", x, funcos(e, x));

    return 0;
}

/* 你的代码将被嵌在这里 */

double funcos( double e, double x )
{
	double index = 1,ret = 1,i = 0;
	while(fabs(index) >= e)
	{
		i++;
		index = index * (-1) * (x*x) / ((2*i) * (2*i-1));
		ret += index;
	}
	return ret;
}